<template>
  <div style="height: 100%;">
    <img
      src="../assets/img/voteentry3.png"
      class="add_form_new"
      @click="vote"
      style="width:100px;height:100px"
      v-show="voteEntry"
    />
    <div class="box" v-show="showFlag">
      <div class="add_form_top">
        <img
          src="../assets/img/pic1.png"
          style="width:50%;height:auto;margin-top: 5%;"
        />
        <span
          style="color: rgba(255,180,0,1);font-size: 20px;font-family:PingFang SC;font-weight:500;"
          >宣贯会现场幸运奖</span
        >
        <span
          style="color: rgba(255,180,0,1);font-size: 20px;font-family:PingFang SC;font-weight:500;"
          >现场已揭晓</span
        >
        <div style="margin-bottom:5%">
          <span
            style="color: #4D86FF;font-size: 14px;font-family:PingFang SC;font-weight:400;"
            >11月5号</span
          >
          <span style="font-size: 14px;font-family:PingFang SC;font-weight:400;"
            >公布胜出方案同时抽取获胜幸运奖</span
          >
        </div>

        <div
          @click="checkInfo"
          class="flex-row2 "
          style="width:70%;height:10%;background:rgba(77,134,255,1);border-radius:8px;z-index:2;margin-bottom: 10%;"
        >
          <span style="color: white;">知道了</span>
        </div>
      </div>
    </div>

    <!-- <x-header v-bind:left-options="{preventGoBack:true}" class="home_head">
      <div slot="overwrite-left">
        前海市政BIM建设管理平台
      </div>
      <div slot="right" class="topic_right">
        <img src="../assets/img/platform.png"/>
        <img src="../assets/img/test_icon.jpg" style="width:24px;height:24px"/>
        <span>{{userName}}</span>
      </div> 
    </x-header>-->
    <div class="main-container">
      <img src="../assets/img/slogan_index.png" class="solgan_index" />
      <swiper
        :list="home_imgs"
        :show-desc-mask="false"
        :show-dots="true"
        dots-position="center"
        height="216px"
        class="swiperImg"
        auto
      ></swiper>
      <span class="temperture">{{ temperature }}</span>
      <img
        src="../assets/img/weather.png"
        class="weather"
        @click="toWeatherHtml"
      />
      <!-- <swiper :list="home_imgs" :show-desc-mask="false" :show-dots="false" height="110px" auto></swiper> -->
      <!-- <img src="../assets/img/scrollImg.png" alt="" style="width: 375px;height: 110px"> -->
      <!-- <swiper height="212px" class=list1 dots-position='center' @on-index-change='indexChange'>
      <swiper-item>
        <grid :cols="4" :show-vertical-dividers="false" :show-lr-borders="false" style="background-color: #ffffff">
          <grid-item v-for="(i,index) in list" :key="index" :link="i.src" :label="i.label" @click.native="showToast(i.src)">
            <img :src="i.img" slot="icon"/>
          </grid-item>
        </grid>
      </swiper-item>
      <swiper-item>
        <grid :cols="4" :show-vertical-dividers="false" :show-lr-borders="false" style="background-color: #ffffff">
          <grid-item v-for="(i,index) in list" :key="index" :link="i.src" :label="i.label" @click.native="showToast(i.src)">
            <img :src="i.img" slot="icon"/>
          </grid-item>
        </grid>
      </swiper-item>
      <swiper-item>
        <grid :cols="4" :show-vertical-dividers="false" :show-lr-borders="false" style="background-color: #ffffff">
          <grid-item v-for="(i,index) in list" :key="index" :link="i.src" :label="i.label" @click.native="showToast(i.src)">
            <img :src="i.img" slot="icon"/>
          </grid-item>
        </grid>
      </swiper-item>
      </swiper>-->
      <swiper dots-position="center" height="230px" class="swiperImg">
        <swiper-item class="black"
          ><grid
            :cols="column"
            :show-vertical-dividers="false"
            :show-lr-borders="false"
            style="background-color:#ffffff;margin-bottom:5%;"
          >
            <grid-item
              v-for="(i, index) in imgList1"
              :key="index"
              :link="i.src"
              :label="i.label"
              v-show="i.flag"
            >
              <img
                v-if="index == 0 && taskNum != ''"
                :src="i.notice_img"
                slot="icon"
              />
              <img v-else :src="i.img" slot="icon" />
            </grid-item>
          </grid>
        </swiper-item>
        <swiper-item v-if="imgList2.length!=0" class="black"
          ><grid
            :cols="column"
            :show-vertical-dividers="false"
            :show-lr-borders="false"
            style="background-color:#ffffff;margin-bottom:5%;"
          >
            <grid-item
              v-for="(i, index) in imgList2"
              :key="index"
              :link="i.src"
              :label="i.label"
              v-show="i.flag"
            >
              <img :src="i.img" slot="icon" />
            </grid-item> </grid
        ></swiper-item>
      </swiper>

      <div style="width:100%;height:2%;background-color:#efeff4"></div>
      <div class="message">
        <div class="topic">
          <div class="left">
            <!-- <img src="../assets/img/title-icon.png" class="title-icon"> -->
            <template v-for="(item, i) in message_titles">
              <div
                class="title"
                @click="getMessage(i)"
                :class="{ active: messageIndex == i }"
                :key="i"
              >
                <span>{{ item }}</span>
                <div class="underline" v-if="messageIndex == i"></div>
                <!-- <img src="../assets/img/title-down.png" v-if="messageIndex == i"> -->
              </div>
            </template>
          </div>
          <!-- <div class="more" @click="moreMessage">...</div> -->
        </div>
        <!-- <hr class="hr"/> -->
        <!-- <panel :list="allList" :type="type"></panel>  v-if="message_list.length > 0"-->

        <div v-if="message_list.length > 0">
          <ul style="margin-top: 15px">
            <li
              v-for="(item, index) in message_list.slice(0, 5)"
              :key="index"
              style="display:block;padding:10px"
              @click="openInfo(item)"
            >
              <!-- <photo-upload title="" :pageToken="pageToken" :fieldToken="fieldToken"
              v-model="item.ATTACHMENTID" :readonly="true" :showOne="true"></photo-upload>-->
              <div
                class="news-item-title"
                v-html="item.TITLE"
                v-if="item.ISFOLDER == 'False'"
              ></div>
              <div v-else class="folder_div" style="display:flex">
                <img src="../assets/img/folder.png" class="folder_img" />
                <div
                  class="news-item-title folder_title"
                  v-html="item.TITLE"
                ></div>
              </div>
              <div class="time">{{ item.DATETIME.substring(0, 10) }}</div>
            </li>
          </ul>
        </div>
        <div v-else style="text-align:center">
          <img
            src="../assets/img/no_message.png"
            style="width:50%;margin-top:15px"
          />
          <div class="no_message">暂无信息</div>
        </div>
        <!--<div v-else class="noMessage">
        该项目暂无相关{{messageIndex == 0 ? '新闻' : '公告'}}
        </div>-->
      </div>
      <!-- <div class="message progress">
      <div class="topic">
        <div class="left">
          <img src="../assets/img/title-icon.png" class="title-icon">
          <div class="title">项目进度情况</div>
        </div>
        <div class="more">...</div>
      </div>
      <hr class="hr"/>
      <div v-if="tasksLevelOne.length > 0">
        <group label-width="5em">
          <popup-picker v-model="tasksLevelOneValue" title='进度板块' :data='tasksLevelOne' placeholder='请选择' @on-change='getTasksLevelTwo'></popup-picker>
        </group>
        <div class="progress-container" v-if="tasksLevelTwo.length > 0">
          <div class="box" v-for="(item, i) in tasksLevelTwo" :key='i'>
            <div class="box-title">
              <img :src="item.src" style="margin-right:10px">
              {{item.NAME}}</div>
            <x-progress :percent='item.PERCENTCOMPLETE' :show-cancel='false' :class="item.color"></x-progress>
          </div>
        </div>
        <div v-else class="noMessage">该进度板块暂无进度信息</div>
      </div>
      <div v-else class="noMessage">
        该项目暂无进度信息
      </div>
      </div>-->
    </div>
  </div>
</template>

<script>
import moment from "moment";
import { Panel, Badge } from "vux";
import $ from "jquery";
import {
  createHSETable,
  populateDB,
  errorCB,
  successCB,
  createHSECheckList,
  createHSEGetproject,
  createHSEGetprojectChild,
  createHSEinspectioninfo,
  createUSERINFO,
  createSYS_PROJECTINFO,
  createPERBASEDATA,
  createUSERSELECTINFO,
  createQualityCheckType,
  createQualityCheckItem,
  createPersonsTable,
  createQualityInspection,
  createDeptTree,
  createHSEcheckLIST,
  createRole_PrjRoleUser,
  createPMBASE_PRJMANAG_DETAIL,
  createPRJMOBILEAPP_R_M_CONFIG,
  createPMBASE_PRJMANAG,
  createV_FIX_GROUP,
  createQualityCheckChilds
} from "../assets/js/SQlite";
var $vue = {};
export default {
  name: "home",
  mounted() {
    this.checkConnection();
    if (this.$store.state.times == 0) {
      this.getsecuretyList(); // 创建本地SQlite数据库并插入安全检查类别数据
      this.getCheckListAll(); // 创建本地检查项目检查项数据表
      this.getProjects(); // 创建本地项目项目部数据表
      this.expandSubPrj(); // 创建项目部分支数据表
      this.getLoginInfo(); //登录信息
      createHSEinspectioninfo(); // 创建安全检查单表
      this.getQualityCheckType(); //创建本地质量检查表类型表
      this.getQualityCheckItem(); //创建本地质量检查项表
      this.getQualityCheckChilds(); //创建本地质量检查子项表
      createHSEcheckLIST(); //创建本地安全巡检表
      createDeptTree(this.$store.state.deptTree); //创建本地部门树数据
      this.getPersons(); //创建本地选人数据
      createQualityInspection(); //创建质量检查单数据表
      this.getv_fix_groupInfo(); //获取v_fix_group数据
      this.$store.commit("setTimes", 1);
    }
  },
  beforeCreate() {
    $vue = this;
  },
  created() {
    if (this.constructionInfoFlag) {
      this.message_titles.push("参建信息");
    }
    if (this.checkNetWork()) {
      this.getWeather(); //天气
      this.getMessage(0); //新闻&公告&文件
      this.getTaskListNum(); //任务待办总数
      this.getVoteFlag();
    } else {
      this.$store.commit("setTaskListCount", 0);
      this.$store.commit("setSystemCount", 0);
    }
    this.handleTabNum();
  },
  data() {
    return {
      initialList: [
        {
          label: "待办任务",
          img: require("../assets/img/task.png"),
          src: "/task",
          notice_img: require("../assets/img/notice_task.png"),
          flag: true
        },
        {
          label: "值班打卡",
          img: require("../assets/img/safetyMonitoring.png"),
          src: "/dutyCard",
          flag: true
        },
        // {label:"现场信息",img:require('../assets/img/siteInformation.png')},'

        {
          label: "安全早会",
          img: require("../assets/img/dangerEdu.png"),
          src: "/safetyMeetingList",
          flag: true
        },
        {
          label: "安全检查",
          img: require("../assets/img/securityCheck.png"),
          src: "/hidangereport_new",
          flag: this.$store.state.dangerFlag
            ? this.$store.state.dangerFlag
            : false
        },
        {
          label: "质量检查",
          img: require("../assets/img/qualityCheck.png"),
          src: "/qualityReport",
          flag: this.$store.state.qualityFlag
            ? this.$store.state.qualityFlag
            : false
        },
        {
          label: "日常巡检",
          img: require("../assets/img/safetyMonitoring.png"),
          src: "/dailyCheck",
          flag: this.$store.state.dailyCheckFlag
            ? this.$store.state.dailyCheckFlag
            : false
        },
        {
          label: "安全监测",
          img: require("../assets/img/safetyMonitor.png"),
          src: "/safetyMonitor",
          flag: true
        },
        {
          label: "安全统计",
          img: require("../assets/img/safetyMonitor.png"),
          src: "/safetyStatistics",
          flag: this.$store.state.safetyStatisticsFlag
            ? this.$store.state.safetyStatisticsFlag
            : false
        },
        {
          label: "文件",
          img: require("../assets/img/file.png"),
          src: "/publicInfo?messageIndex=0",
          flag: true
        },
        {
          label: "公告",
          img: require("../assets/img/notice.png"),
          src: "/publicInfo?messageIndex=1",
          flag: true
        },
        {
          label: "新闻",
          img: require("../assets/img/news.png"),
          src: "/publicInfo?messageIndex=2",
          flag: true
        },
        {
          label: "通讯录",
          img: require("../assets/img/addressBook.png"),
          src: "/addressBook",
          flag: true
        },
        {
          label: "用户反馈",
          img: require("../assets/img/userback1.png"),
          src: "/userBack",
          flag: true
        }
      ],
      imgList1: [],
      imgList2: [],
      list: [],
      directory: "",
      home_imgs: [
        {
          url: "javascript:",
          img: require("../assets/img/scrollImg.png"),
          title: "图片1"
        },
        {
          url: "javascript:",
          img: require("../assets/img/scrollImg.png"),
          title: "图片2"
        },
        {
          url: "javascript:",
          img: require("../assets/img/scrollImg.png"),
          title: "图片3"
        }
      ],
      message_list: [],
      userName: this.$store.state.user.ADUSER_NAME,
      message_titles: ["文件", "公告", "新闻"],
      messageIndex: 0,
      tasksLevelOne: [],
      tasksLevelOneValue: [],
      tasksOneOrigin: [],
      tasksLevelTwo: [],
      progressColor: "",
      type: "1",
      temperature: "",
      home: "fromHome",
      taskNum: "",
      countNum: 0, //质量、安全、巡检三个模块能展示的数量
      column: this.$store.state.column, //模块列数
      showFlag: false,
      voteEntry: false,
      voteFlag: false,
      voteEndFlag: false,
      showPrizeString: "待定",
      constructionInfoFlag: this.$store.state.constructionInfoFlag
    };
  },
  methods: {
    handleTabNum() {
      let tempArr = [];
      tempArr = this.initialList.filter(item => {
        return item.flag == true;
      });
      console.log("tempArr", tempArr);
      // 目前第二页只有五个如果后续新增请更新此方法
      // 一页八个
      if (tempArr.length > 8) {
        this.imgList1 = tempArr.slice(0,8)
        this.imgList2 = tempArr.slice(8)
        console.log("tempArr", this.imgList1,this.imgList2);
      }else{
        this.imgList1 = tempArr
      }
    },
    checkConnection() {
      console.log("网络是否良好", this.checkNetWork());
    },
    //获取投票截止时间、开奖时间
    getVoteFlag() {
      let paramsMD5 = '{"_method":"HOME_FIX_PERMISSION_MENU.getAccess"' + "}";
      this.$ajax({
        methods: "post",
        url: this.COMMON_URL,
        // params: this.signMD5({ FixJSON: paramsMD5 }),
        params: { FixJSON: paramsMD5 }
      }).then(res => {
        this.voteEndTime = res.data.voteEndString;
        this.showPrizeString = res.data.showPrizeString;
        // this.voteEntry=res.data.voteEntry;
        // this.voteFlag=res.data.voteflag;
        // this.voteEndFlag=res.data.voteEndFlag;
        let showStartTime = res.data.showStartTime;
        let showEndTime = res.data.showEndTime;
        let voteEndTime = res.data.voteEndTime;
        let showPrizeTime = res.data.showPrizeTime;
        let nowTime = new Date().getTime();
        this.voteEntry = showStartTime <= nowTime && showEndTime >= nowTime;
        this.voteFlag = nowTime <= voteEndTime;
        this.voteEndFlag = nowTime >= voteEndTime && nowTime <= showPrizeTime;
      });
    },
    checkInfo() {
      this.showFlag = false;
    },
    vote() {
      //投票截止时间

      let paramsMD5 = '{"_method":"HOME_FIX_PERMISSION_MENU.getAccess"' + "}";
      this.$ajax({
        methods: "post",
        url: this.COMMON_URL,
        // params: this.signMD5({ FixJSON: paramsMD5 }),
        params: { FixJSON: paramsMD5 }
      }).then(res => {
        this.voteEndTime = res.data.voteEndString;
        this.showPrizeString = res.data.showPrizeString;
        // this.voteEntry=res.data.voteEntry;
        // this.voteFlag=res.data.voteflag;
        // this.voteEndFlag=res.data.voteEndFlag;
        let showStartTime = res.data.showStartTime;
        let showEndTime = res.data.showEndTime;
        let voteEndTime = res.data.voteEndTime;
        let showPrizeTime = res.data.showPrizeTime;
        let nowTime = new Date().getTime();
        this.voteEntry = showStartTime <= nowTime && showEndTime >= nowTime;
        this.voteFlag = nowTime <= voteEndTime;
        this.voteEndFlag = nowTime >= voteEndTime && nowTime <= showPrizeTime;

        if (this.voteFlag) {
          this.$router.push({
            path: "/index/vote",
            query: {}
          });
        } else if (this.voteEndFlag) {
          this.showFlag = true;
        } else {
          this.$router.push({
            path: "/index/showPrize",
            query: {}
          });
        }
      });
    },
    getv_fix_groupInfo() {
      // let params = {
      //   FixJSON: {
      //     _method: "HOME_FIX_PERMISSION_MENU.getV_Fix_GroupInfo",
      //   }
      // };
      let paramsMD5 =
        '{"_method": "HOME_FIX_PERMISSION_MENU.getV_Fix_GroupInfo"}';
      this.$ajax({
        url: this.COMMON_URL,
        methods: "post",
        //  params:params
        // params: this.signMD5({ FixJSON: paramsMD5 }),
        params: { FixJSON: paramsMD5 }
      }).then(res => {
        // console.log("加密后",res);
        createV_FIX_GROUP(res.data.data);
      });
    },
    getPersons() {
      // let paramsMD5 = '{"MiniQueryFormData":{"RoleId":"","ChooseProjectId":"","GroupId":"","UserFullName":""}'+
      //   '"pageIndex": "0","pageSize": "1000","sortField": "USER_FULLNAME","sortOrder": "asc"}'
      this.$ajax({
        method: "post",
        url: this.COMMON_URL,
        // +"?_method=V_USER_SELECT*getHRUserList&filter=&type=prj&projectId=0",
        data: {
          _method: "V_USER_SELECT*getHRUserList",
          type: "prj",
          projectId: "0",
          MiniQueryFormData:
            '{"RoleId":"","ChooseProjectId":"","GroupId":"","UserFullName":""}',
          pageIndex: "0",
          pageSize: "1000",
          sortField: "USER_FULLNAME",
          sortOrder: "asc"
        }
        // params:this.signMD5({FixJSON:paramsMD5})
      }).then(res => {
        console.log("获取人员数据111", res);
        createPersonsTable(res.data.data);
      });
    },
    getQualityCheckItem() {
      let params = {
        FixJSON: JSON.stringify({
          _method: "component.getListData",
          _param: {
            bizObj: "PMQUALITY_INSPECT_ITEM",
            service: "selectMore",
            fields: "*",
            currentPageIndex: 1,
            pageSize: 999999,
            orderList: [{ order: "asc", field: "INSPECTITEM" }],
            QueryFormData: ""
          }
        })
      };
      this.$ajax({
        url: this.COMMON_URL,
        method: "post",
        params: params
      }).then(res => {
        console.log("质量item", res);
        let data = res.data.datas;
        createQualityCheckItem(data);
      });
    },
    getQualityCheckChilds() {
      let params = {
        FixJSON: JSON.stringify({
          _method: "component.getListData",
          _param: {
            bizObj: "PMQUALITY_INSPECT_TYPECHILD_DETAIL",
            service: "selectMore",
            fields: "CHILDINSPECTITEM,INSPECTITEM,FORMTYPE",
            currentPageIndex: 1,
            pageSize: 999999,
            orderList: [{ order: "asc", field: "CHILDINSPECTITEM" }],
            QueryFormData: ""
          }
        })
      };
      this.$ajax({
        url: this.COMMON_URL,
        method: "post",
        params: params
      }).then(res => {
        console.log("检查子项", res);
        createQualityCheckChilds(res.data.datas);
      });
    },
    getQualityCheckType() {
      let params = {
        FixJSON: JSON.stringify({
          _method: "component.getBatchDatas",
          _param: {
            controls: {
              CHECKTYPE: {
                orgConfig: {
                  Filter: "1=1",
                  Fields: "CODE_ID,CODE_NAME",
                  OrderList: [{ order: "asc", field: "CODE_ORDER" }],
                  BizObj: "FIX_SYS_CODE",
                  Service: "selectMore_defauld",
                  componentType: "ECIDIHTMLSelect"
                },
                dataConfig: {
                  Method: "component.getListData",
                  Param: {
                    bizObj: "FIX_SYS_CODE",
                    service: "selectMore_defauld",
                    fields: "CODE_ID,CODE_NAME",
                    filter: "TYPE_ID='PMQUALITY_INSPECTION.CHECKTYPE'",
                    currentPageIndex: 1,
                    pageSize: 999999,
                    orderList: [{ order: "asc", field: "CODE_ORDER" }],
                    QueryFormData: ""
                  },
                  componentType: "ECIDIHTMLSelect"
                },
                storeType: "Data"
              }
            }
          }
        })
      };
      this.$ajax({
        url: this.COMMON_URL + "?_viewId=PMQUALITY_INSPECTION_list",
        method: "post",
        data: params
      }).then(res => {
        let types = res.data.datas.CHECKTYPE;
        createQualityCheckType(types);
      });
    },
    getLoginInfo() {
      // let params = {
      //   FixJSON: {
      //     _method: "HOME_FIX_PERMISSION_MENU.getLoginInfo"
      //   }
      // };
      let paramsMD5 = '{"_method": "HOME_FIX_PERMISSION_MENU.getLoginInfo"}';
      this.$ajax({
        url: this.COMMON_URL,
        methods: "post",
        // params: params,
        // params: this.signMD5({ FixJSON: paramsMD5 }),
        params: { FixJSON: paramsMD5 }
      }).then(res => {
        console.log("@@@", res);
        createUSERINFO(res.data.userInfoData);
        createSYS_PROJECTINFO(res.data.projectInfoData);
        createPERBASEDATA(res.data.perBaseData);
        createUSERSELECTINFO(res.data.userSelectData);
        createPRJMOBILEAPP_R_M_CONFIG(res.data.appData);
        createPMBASE_PRJMANAG_DETAIL(res.data.prjmanDetailData);
        createRole_PrjRoleUser(res.data.prjRoleUserData);
        createPMBASE_PRJMANAG(res.data.prjmanagData);
      });
    },
    expandSubPrj() {
      let params = {
        FixJSON: JSON.stringify({
          _method: "component.getListData",
          _param: {
            bizObj: "PMBASE_PRJMANAG",
            service: "selectPrjByPMMore",
            fields: "*",
            currentPageIndex: "1",
            pageSize: "9999",
            orderList: [
              {
                field: "PMID",
                order: "desc"
              }
            ]
          }
        })
      };
      this.$ajax({
        url:
          this.COMMON_URL +
          "?_objName=PMBASE_PRJMANAG&_viewId=PMBASE_PRJFORINSPECTION",
        method: "post",
        params: params
      }).then(res => {
        createHSEGetprojectChild(res.data.datas);
      });
    },
    getProjects() {
      let params = {
        FixJSON: JSON.stringify({
          _method: "component.getListData",
          _param: {
            bizObj: "PMBASE_PRJMANAG",
            service: "selectPMStaffMoreNew",
            fields: "*",
            currentPageIndex: 1,
            pageSize: "9999",
            orderList: [{ field: "ISPRJMANAG", order: "desc" }],
            QueryFormData: { PROJECTNAME: "", PROJECTNO: "" }
          }
        }),
        cookies: ""
      };

      this.$ajax({
        url:
          this.COMMON_URL +
          "?_objName=PMBASE_PRJMANAG&_viewId=PMBASE_PMStaff_list_new",
        method: "post",
        params: params
      }).then(res => {
        console.log("pmbase_prjman", res);
        createHSEGetproject(res.data.datas);
      });
    },
    getCheckListAll() {
      this.$ajax({
        url: this.COMMON_URL,
        data: {
          _method: "HOME_FIX_PERMISSION_MENU.getCheckListAll"
        },
        // params: this.signMD5({
        //   _method: "HOME_FIX_PERMISSION_MENU.getCheckListAll"
        // }),
        method: "post"
      }).then(res => {
        console.log(res);
        createHSECheckList(res.data.data);
      });
    },
    getsecuretyList() {
      //this.fatherClass=[[""]];
      this.$ajax({
        url: this.COMMON_URL,
        data: {
          _method: "HOME_FIX_PERMISSION_MENU.getSubClassw"
        },
        // params: this.signMD5({
        //   _method: "HOME_FIX_PERMISSION_MENU.getSubClassw"
        // }),
        method: "post"
      }).then(res => {
        //  console.log("weith", res);
        createHSETable(res.data.data);
      });
    },
    getTaskListNum() {
      this.$ajax({
        method: "post",
        url: this.COMMON_URL,
        data: {
          _method: "formflow.getTaskListCount",
          filter: "( flag in ('0','1','201','401'))"
        }
        // params: this.signMD5({
        //   _method: "formflow.getTaskListCount",
        //   filter: "( flag in ('0','1','201','401'))"
        // })
      }).then(res => {
        console.log(res);
        this.taskNum = res.data.data;
        if (res.data.data) {
          this.$store.commit("setTaskListCount", res.data.data);
        }
      });
    },
    //跳转天气页面
    toWeatherHtml() {
      // window.location.href =
      //   "https://apip.weatherdt.com/h5.html?id=tCl0iyQSiF";
      this.$router.push({
        path: "/weather"
      });
    },

    // getMessage(i) {
    //   console.log(this.userInfo.projectId)
    //   //const sysprjid = this.projInfo.PROJECTID
    //   const sysprjid = this.userInfo.projectId
    //   this.messageIndex = i
    //   const FixJSON1 = {
    //     _method: "HOME_FIX_PERMISSION_MENU.CloudGetNew",
    //     DepartmentID: 1,
    //     sysprjid: "0",
    //   }
    //   const FixJSON0 = {
    //     _method: "HOME_FIX_PERMISSION_MENU.CloudGetNewsInfo",
    //     newsType : "1",
    //     sysPrjId: "0",
    //   }

    //   const FixJSON2 = {
    //     _method : "HOME_FIX_PERMISSION_MENU.CloudGetFile",
    //     filesType : "1",
    //     sysPrjId: "0",
    //   }
    //   var FixJSON = ""
    //   if(i==0){
    //     FixJSON = JSON.stringify(FixJSON0)
    //   }else if(i==1){
    //     FixJSON = JSON.stringify(FixJSON1)
    //   }else{
    //     FixJSON = JSON.stringify(FixJSON2)
    //   }
    //   //let FixJSON = i == 1 ? JSON.stringify(FixJSON1) :JSON.stringify(FixJSON2)
    //   console.log(FixJSON)
    //   this.$ajax({
    //     url: this.COMMON_URL,
    //     method: 'POST',
    //     data: {
    //       FixJSON
    //     }
    //   }).then(res => {
    //     console.log("mao");
    //     console.log(res);
    //     if(i==0){
    //       this.message_list = res.data.news_0
    //     }else if(i==1){
    //       this.message_list = res.data.o0
    //     }else{
    //       this.message_list = res.data.files_0
    //     }

    //     // if (res.data && ((res.data.news && res.data.news.length > 0) || (res.data.NewsType && res.data.NewsType.length > 0))) {
    //     //   const datas = res.data.news ? 'news_' + sysprjid : 'o' + sysprjid
    //     //   let info = (res.data[datas])
    //     //   info.forEach(item => {
    //     //     item.DATETIME = moment(item.DATETIME).format('DD/MM')
    //     //   })
    //     //   if (info.length > 3){
    //     //     info = info.slice(0, 3)
    //     //   }
    //     //   this.message_list = [...info]
    //     //   this.directory = this.message_list[0].DIRECTORY
    //     // }
    //     // console.log(this.message_list)
    //   })
    // },
    getMessage(i) {
      this.messageIndex = i;

      var temp = 0;
      if (i == 0) {
        //文件
        temp = 10420;
      } else if (i == 1) {
        //公告
        temp = 10417;
      } else if (i == 2) {
        //新闻
        temp = 10416;
      } else {
        //参建信息
        temp = 10558;
      }
      // let paramsMD5 = {
      //     pageIndex: this.pageIndex,
      //     pageSize: this.pageSize,
      //     sortField: "DATETIME",
      //     sortOrder: "desc"
      // }
      //      let json = {
      //       FixJSON : JSON.stringify(paramsMD5),
      //     }
      this.$ajax({
        url: this.COMMON_URL,
        // + "?_method=CMS_COMMON.getDataList&tableName=CMS_INFORMATION&directory=" +
        temp,
        method: "POST",
        data: {
          _method: "CMS_COMMON.getDataList",
          tableName: "CMS_INFORMATION",
          directory: temp,
          pageIndex: this.pageIndex,
          pageSize: this.pageSize,
          sortField: "DATETIME",
          sortOrder: "desc"
        }
        // params:this.signMD5(json)
      }).then(res => {
        console.log("message_list", res);
        this.message_list = res.data.data;
      });
    },
    //获取天气信息展示在首页
    getWeather() {
      var temp1 = "";
      var temp2 = "";
      var temp = "";
      $.ajax({
        url:
          "https://devapi.qweather.com/v7/weather/now?location=101280604&key=700a3e4846174d829189279cdb659501",
        method: "GET",
        success: function(response) {
          if (response.code == "200") {
            $vue.temperature = response.now.temp + "℃";
          }
        }
      });

      // this.$ajax({
      //   url : this.WEATHER_URL + "/api/?version=v6&city=",
      //   // url : "http://www.weather.com.cn/data/cityinfo/101280601.html",
      //   method : 'GET',
      //   // data:'version=v6&city=',
      //   async : false,
      // }).then(function(response){
      //   console.log(response);
      // })
    },
    //打开新闻、公告、文件详情
    openInfo(item) {
      console.log(this.messageIndex);
      if (item.ISFOLDER == "True") {
        //是文件夹
        //@params{
        // item: 新闻、公告、文件详情
        // messageIndex:角标分别对应2,1,0
        // home:用于判断是否返回首页
        //}
        this.$router.push({
          path: "/publicInfo/folderDetail",
          name: "folderDetail",
          params: {
            item: item,
            messageIndex: this.messageIndex,
            home: this.home
          }
        });
      } else {
        this.$router.push({
          path: "/publicInfo/publicDetailInfo",
          name: "publicDetailInfo",
          query: {
            item: item,
            title: item.TITLE,
            datetime: item.DATETIME,
            content: item.CONTENT,
            contentattachmentid: item.CONTENTATTACHMENTID,
            attachmentid: item.ATTACHMENTID,
            messageIndex: this.messageIndex,
            home: this.home
          }
        });
      }
    }
  },
  computed: {
    userInfo() {
      return this.$store.state.user;
    },
    projInfo() {
      return this.$store.state.projInfo;
    }
    // dailyCheckFlag(){
    //   return this.$store.state.dailyCheckFlag
    // },
    // qualityFlag(){
    //   return this.$store.state.qualityFlag
    // },
    // dangerFlag(){
    //   return this.$store.state.dangerFlag
    // }
  },
  components: {
    Panel,
    Badge
  }
};
</script>

<style scoped>
@font-face {
  font-family: sszh;
  src: url("../assets/font/时尚中黑简体.ttf");
}
.hr {
  margin-top: 5px;
}
.home_title {
  margin-left: 10px;
  font-size: 13px;
  font-family: sszh;
}
.home-nav-container {
  /* background-color: #35495e; */
  display: -webkit-flex;
  display: flex;
}
.home-nav-item {
  padding: 12px 0;
  text-align: center;
  color: white;
  font-size: 14px;
  flex: auto;
}
.home-nav-item:active {
  background-color: #3e4e5e;
}
.home-nav-icon {
  height: 28px;
}
.home-cell-icon {
  width: 40px;
  height: 40px;
}
.message {
  width: 100%;
  height: 145px;
  padding: 4px 30px;
  margin-top: 10px;
  background-color: #ffffff;
  box-sizing: border-box;
}
.message .topic {
  display: flex;
  /* justify-content: space-between; */
  justify-content: center;
  box-sizing: border-box;
}
.message .topic {
  display: flex;
  border-bottom: 1px solid #eeeeee;
  width: 100%;
}
.message .topic .left {
  display: flex;
  /* position: relative; */
  width: 100%;
  justify-content: space-around;
}
.message .topic .title {
  box-sizing: border-box;
  font-size: 16px;
  color: #c2c4c8;
  font-weight: bold;
  height: 30px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
}
.message .topic .active {
  color: #4d8aff;
}
.message .topic .more {
  font-size: 24px;
  color: #b6b6b6;
  line-height: 24px;
}
.no_message {
  font-size: 13px;
  font-family: PingFang SC;
  font-weight: 400;
  color: rgba(187, 187, 187, 1);
  line-height: 10px;
}
ul li {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  border-bottom: 1px solid #eeeeee;
}
li .info {
  width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  color: #333333;
  line-height: 22px;
}
li .time {
  font-size: 12px;
  color: #b6b6b6;
  line-height: 22px;
  margin-top: 3px;
}
.swiper-img {
  height: 110px;
}
.weui-toast.vux-toast-bottom {
  bottom: calc(50% - 60px);
}
.list1 {
  background-color: rgb(255, 255, 255);
  transform: translateY(-30px);
  width: 91%;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 0 20px #888888;
}
.title-icon {
  position: absolute;
  top: 15px;
  left: -20px;
}
.progress .title {
  color: #0574ff !important;
}
.progress-container {
  overflow: auto;
  width: 100%;
  max-height: 150px;
  position: relative;
}
.progress-container .box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #404040;
  margin-top: 8px;
  margin-bottom: 5px;
}
.box-title {
  align-items: center;
  display: flex;
}
.weui-progress {
  width: 40%;
  height: 10px;
  border-radius: 2px;
  margin-right: 10px;
}
.weui-progress__bar {
  height: 10px !important;
  border-radius: 2px;
}
.complete .weui-progress__inner-bar {
  background: linear-gradient(to right, #1dc4e9, #1de9b6);
}
.going .weui-progress__inner-bar {
  background: linear-gradient(90deg, #0098ff, #82a8ff);
}
.noMessage {
  line-height: 50px;
  text-align: center;
  color: #404040;
  font-size: 14px;
}
.swiperImg {
  border-bottom-right-radius: 50% 20px;
  border-bottom-left-radius: 50% 20px;
}
.main-container /deep/ .weui-grids:before {
  border-top: none;
}
.main-container .weui-grids /deep/ .weui-grid {
  padding: 25px 10px;
}
.weui-grids .weui-grid /deep/ .weui-grid__icon {
  width: 40px !important;
  height: 40px !important;
}
.main-container /deep/ .vux-slider .vux-indicator .vux-icon-dot.active {
  background-color: #ffffff;
  width: 15px;
}
.solgan_index {
  position: absolute;
  top: 5%;
  left: 5%;
  z-index: 999;
  width: 200px;
}
.weather {
  position: absolute;
  top: 5%;
  left: 85%;
  z-index: 999;
  width: 30px;
  height: 30px;
}
.temperture {
  position: absolute;
  top: 6%;
  left: 75%;
  z-index: 999;
  width: 30px;
  height: 30px;
  color: #ffffff;
}
.underline {
  width: 16px;
  height: 3px;
  background: #4d8aff;
  border-radius: 4px;
  margin: auto;
  margin-top: 2px;
  /* position: relative;
  top: 40%;
  left: 20%; */
}
.add_form_new {
  position: absolute;
  width: 100px;
  height: 100px;
  top: 60%;
  z-index: 997;
  right: 0;
}
.add_form_top {
  position: absolute;
  width: 80%;
  height: 50%;
  top: 20%;
  z-index: 999;
  left: 10%;
  background: url(../assets/img/background1.png) no-repeat white;
  background-size: 100% auto;
  /* box-shadow:0px 1px 13px 0px rgba(79,132,220,0.6); */
  border-radius: 20px;
  /* color: #ffffff; */
  font-size: 14px;
  font-family: PingFang SC;
  font-weight: 400;
  line-height: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}
.flex-row2 {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
}

.box {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(10, 10, 10, 0.6);
  z-index: 998;
}
</style>
